#include <stdio.h>
#include "DoubleLinkList.h"
#include "LinkStack.h"

void printInt(void *value)
{
    int v = (int)value;
    printf("%d ", v);
}

bool IsEqual(void *v1, void *v2)
{
    int a = (int)v1;
    int b = (int)v2;
    return a == b;
}

bool IsEvenNum(void *v1, void *v2)
{
    int a = (int)v1;
    int b = (int)v2;
    return b % a == 0;
}

int main()
{
    // DLlist list;
    // InitDLlist(&list);

    // for (int i = 0; i < 10; i++)
    // {
    //     InsertDLlistTail(&list, i+1);
    // }
    // for (int i = 0; i < 10; i++)
    // {
    //     InsertDLlistHead(&list, i+1);
    // }
    // Travel(&list, printInt);
    // InsertByIndex(&list, 20, 0);
    // Travel(&list, printInt);

    // RemoveByElement(&list, 2, IsEvenNum);
    // Travel(&list, printInt);
    // ReTravel(&list, printInt);

    // DLlist result = FindByElement(&list, 5, IsEvenNum);
    // Travel(&result, printInt);

    // FreeDLlist(&list, NULL);
    // FreeDLlist(&result, NULL);

    LStack s;
    Init(&s);
    for (int i = 0; i < 10; i++)
    {
        SPush(&s, i+1);
    }
    while (IsStackEmpty(&s) == false)
    {
        printf("%d ", (int)*GetTop(&s));
        SPop(&s);
    }
    printf("\n");
    
    return 0;
}